"""
【第三题】
空气质量查询工具
实现循环输入
按Q才退出
"""

print("空气质量查询工具（按Q退出）")
print("（空气质量指数的取值为大于等于0）")
num = input("请输入你要查询的空气指数：")

#设置一个指数存储器
q = 0

#循环体支持重复查询
while num != "Q":
    if num.isdigit():
        if int(num) <= 50:
            q = "优"
        elif int(num) >= 51 and int(num) <= 100:
            q = "良"
        elif int(num) >= 101 and int(num) <= 150:
            q = "轻度污染"
        elif int(num) >= 151 and int(num) <= 200:
            q = "中度污染"
        elif int(num) >= 201 and int(num) <= 250:
            q = "重度污染"
        else:
            q = "严重污染"

        print(f"空气质量状况为:{q}")

    else:
        print("请合法输入！")

    print("------------------------------------")
    print("空气质量查询工具（按Q退出）")
    print("（空气质量指数的取值为大于等于0）")
    num = input("请输入你要查询的空气指数：")

print("您已退出程序！")

